1. Field of the Invention
The present invention relates generally to computer systems and, in particular, to stack-based memory architectures.
2. Discussion of Related Art
A typical computing system includes a processing unit and a memory unit. Most computing systems use a random access memory architecture for the memory unit. However, some computing systems use a stack architecture for the memory unit. For example, FIG. 1 shows a stack-based computing system 100 coupled to a stack 110. A classical stack memory unit uses a last in first out access model. Conceptually, new data entering a stack memory unit is placed on top of the existing data, i.e., in the next available memory location. If data is requested from the stack, the last piece of data "on top of" the stack is retrieved first. For certain applications, stack-based memory architectures provide several advantages over random access memory architectures. For example, a stack memory architecture is well suited for a calculator using RPN notation.
Stack 110 of stack-based computing system 100 is primarily used as a repository of information for methods, e.g., subroutines or threads. At any point in time, stack-based computing system 100 is executing a single method, i.e. the current method. Each method has memory space, i.e., a method frame on stack 110. Stack-based computing system 100 allocates a new method frame, e.g., method frame D 210, upon a method invocation. The new method becomes the current method frame, i.e., the method frame of the current method Current method frame D 210, as well as the other method frames, may contain various frame components such as object references, incoming arguments, local variables, the invoker's method context, an operand stack, and a return value from the method. The specific frame components in a particular method frame depend on various method invoking situations.
In FIG. 2, object reference, incoming arguments, and local variables are included in arguments and local variables area 211. The invoker's method context is included in execution environment 222, sometimes called frame state, that in turn may include: a return program counter value that is the address of the virtual machine instruction, e.g., JAVA opcode, next to the method invoke instruction; a return frame that is the location of the calling method's frame; a return constant pool pointer that is a pointer to the calling method's constant pool table; a current method vector that is the base address of the current method's vector table; and a current monitor address that is the address of the current method's monitor. Although FIG. 2 depicts each method frame separately, some embodiments of stack-based computing system 100 use overlapping method frames. For example, if method D embodied by method frame D 210 was invoked by method C embodied by method frame C 220, method C would place many of the arguments and local variables for method D on the operand stack of method frame C. Therefore, in some embodiments of stack 110, a portion of the operand stack of one method is also a portion of the arguments and local variables area of another method frame.
The performance of some stack-based computing systems, such as the JAVA virtual machine, improves if the stack-based memory system supports data access to other portions of the stack in addition to the top of the stack. For example, in executing method D variables from arguments and local variables area 211 may often be required. One method to provide access to portions of the stack other than the top of the stack is to use a multi-ported stack cache. For example, a stack cache can be used to store a top portion of the stack. The stack cache then provides standard pushing and popping at the top of the stack as well as an input/output port to access other data in the stack cache. An implementation of a stack cache is described in U.S. patent application Ser. No. 08/787,736, entitled "METHODS AND APPARATUSES FOR STACK CACHING" naming Marc Tremblay and James Michael O'Connor as inventors, assigned to the assignee of this application, and filed on Jan. 23, 1997, which is incorporated herein by reference in its entirety. Further details of a pipelined stack cache is described in U.S. patent application Ser. No. 08/829,100, entitled "PIPELINED STACK CACHING METHOD" naming Sailendra Koppala as inventor, assigned to the assignee of this application, and filed on Mar. 31, 1997, which is incorporated herein by reference in its entirety.
However, a stack cache has a limited number of memory locations. As programs for stack-based computing systems evolve, methods on stack-based computing systems are becoming more complex. For example, application programs such as word processors are being adapted to the JAVA virtual machine, which is a stack-based computing system. These complex methods may use an operand stack greater than the capacity of the stack cache. Therefore, the arguments and local variables area of the current method frame may not be available in the stack cache. Hence, there is a need for a memory architecture providing benefits of a stack with the ability to provide easy access to multiple locations in the memory architecture.